﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Catequese
{
    public partial class frmLogin : Form
    {
        public frmLogin()
        {
            InitializeComponent();
        }

        private void frmLogin_Load(object sender, EventArgs e)
        {

        }

        private void btnCancelar_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        private void btnEntrar_Click(object sender, EventArgs e)
        {
            if (txtUsername.Text == "" || txtUsername.Text == string.Empty)
            {
                MessageBox.Show("Digite o nome de utilizador");
                txtUsername.Focus();
                return;
            }

            if (txtPassword.Text == "" || txtPassword.Text == string.Empty)
            {
                MessageBox.Show("Digite a Palavra-passe");
                txtUsername.Focus();
                return;
            }

            Classes.Catequistas Catequista = new Classes.Catequistas();
            Catequista.Username = txtUsername.Text.Trim();
            Catequista.Password = txtPassword.Text.Trim();

            if (Catequista.Autenticar())
            {
                MessageBox.Show("Sucesso");
            }

            else
            {
                MessageBox.Show("erro");
            }


        }
    }
}
